package com.hsz.autotest.controller;

import com.hsz.autotest.entity.User;
import com.hsz.autotest.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class UserController {
    @Autowired
    UserService userservice;

    @ResponseBody
    public String user(){
        return "adduser";
    }

    @ResponseBody
    @RequestMapping("/addUser")
    public String addUser(User user){
        userservice.addUser(user);
        return "success";
    }

    @ResponseBody
    @RequestMapping("/queryUser")
    public List<User> queryUser(Integer id, String phone){
        List<User> user= userservice.queryUser(id, phone);
        return user;
    }



}
